<?php require 'common/header.php';?>
<?php require 'common/left.php';?>
<div id="main-content">
  <h2>欢迎您 <?php echo $_COOKIE['adminname'];?></h2>
  <p id="page-intro">文章管理。</p>
  <div class="clear"></div>
  <div class="content-box">
    <div class="content-box-header">
      <h3>文章管理</h3>
      <ul class="content-box-tabs">
      	 <li><a href="<?php echo Qtpl::createUrl('article', 'index','','admin');?>" class="default-tab">文章列表</a></li>
         <li><a href="<?php echo Qtpl::createUrl('article', 'show','','admin');?>">添加文章</a></li>
	  </ul>
      <div class="clear"></div>
    </div>
    <div class="content-box-content">
      <div class="tab-content default-tab" id="tab1" style="display: block;">
        <table>
          <thead>
            <tr>
              <th>编号</th>
              <th>标题</th>
              <th>浏览数</th>
              <th>来自</th>
              <th>提交时间</th>
              <th>操作</th>
            </tr>
          </thead>
          <tfoot>
            <tr>
              <td colspan="5"><?php echo Qtpl::paged($_tpl['pageSize'],core_lib_constant::PAGE_NUM,$_tpl['page'],'article','index','style','admin');?></td>
            </tr>
          </tfoot>
          <tbody>
          <?php 
          if($_tpl['article']){
          	foreach ($_tpl['article'] as $k=>$v) {
          		$altrow = $k/2 == 0 ? 'alt-row' : '';
          ?>
           <tr class="<?php echo $altrow;?>">
            <td><?php echo Qutil::enId($v['aid']);?></td>
            <td><?php echo $v['title'];?></td>
            <td><?php echo $v['views'];?></td>
            <td><?php echo $v['from'];?></td>
            <td><?php echo date('Y-m-d H:i:s', $v['create_time']);?></td>
            <td><a href="<?php echo Qtpl::createUrl('article', 'show',array('aid'=>$v['aid']),'admin');?>">编辑</a>|<a onclick="return confirm('你确定要删除吗？');" href="<?php echo Qtpl::createUrl('article', 'del',array('aid'=>$v['aid'],'token'=>$_tpl['token']),'admin');?>">删除</a></td>
          <?php
          		}
          	}else{
          		echo '<td colspan="8">暂无内容</td>';
          	}
          ?>
          </tr>
         </tbody>
        </table>
      </div>
    </div>
  </div>
<?php require 'common/footer.php';?>